package com.ruoyi.app.controller

import com.ruoyi.ability.CartoonParam
import com.ruoyi.ability.PicToPicParam
import com.ruoyi.ability.TextToPicParam
import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.app.domain.dto.UserRecordDto
import com.ruoyi.app.domain.v3.dto.MyCollectDto
import com.ruoyi.app.domain.v3.dto.MyRecordDto
import com.ruoyi.app.domain.v3.vo.MyRecordVo
import com.ruoyi.app.domain.vo.PicProcessResultVo
import com.ruoyi.app.domain.vo.UserRecordVo
import com.ruoyi.app.service.Pic2PicModel
import com.ruoyi.app.service.Text2PicModel
import com.ruoyi.app.service.UserExperienceRecordApiService
import com.ruoyi.app.service.UserRecordApiService
import com.ruoyi.back.domain.FunctionSon
import com.ruoyi.back.domain.v3.dto.StyleSearchDto
import com.ruoyi.back.domain.v3.vo.CartoonStyleVo
import com.ruoyi.back.domain.v3.vo.Pic2PicStyleVo
import com.ruoyi.back.domain.v3.vo.Text2PicStyleVo
import com.ruoyi.back.service.v3.StyleSettingService
import com.ruoyi.back.service.v3.TemplateReportService
import com.ruoyi.common.core.page.PageDomain
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("api/userRecord")
@Api(tags = ["创作相关接口"])
class RecordApiController {

    @Autowired
    private lateinit var userRecordApiService: UserRecordApiService

    @Autowired
    private lateinit var styleSettingService: StyleSettingService

    @Autowired
    private lateinit var userExperienceRecordApiService: UserExperienceRecordApiService

    @ApiOperation("功能尺寸列表 type: 1.文生图 2.图生图")
    @GetMapping("functionResolution")
    fun functionResolution(type: Int): Data<List<FunctionSon>> =
        userRecordApiService.functionResolution(type)

    @ApiOperation("文生图style列表")
    @GetMapping("text2PicStyleList")
    fun text2PicStyleList(styleSearchDto: StyleSearchDto): Data<List<Text2PicStyleVo>> =
        styleSettingService.text2PicStyleList(styleSearchDto)

    @ApiOperation("图生图style列表")
    @GetMapping("pic2PicStyleList")
    fun pic2PicStyleList(styleSearchDto: StyleSearchDto): Data<List<Pic2PicStyleVo>> =
        styleSettingService.pic2PicStyleList(styleSearchDto)

    @ApiOperation("卡通style列表")
    @GetMapping("cartoonStyleList")
    fun cartoonStyleList(styleSearchDto: StyleSearchDto): Data<List<CartoonStyleVo>> =
        styleSettingService.cartoonStyleList(styleSearchDto)

    @ApiOperation("体验文生图 图生图")
    @GetMapping("experienceRecord")
    fun experienceRecord(id: Long): Data<PicProcessResultVo> = userExperienceRecordApiService.experienceRecord(id)

    @ApiOperation("获取文生图模板")
    @GetMapping("getText2PicModel")
    fun getText2PicModel(): Data<List<Text2PicModel>> = userExperienceRecordApiService.getText2PicModel()

    @ApiOperation("获取图生图模板")
    @GetMapping("getPic2PicModel")
    fun getPic2PicModel(): Data<List<Pic2PicModel>> = userExperienceRecordApiService.getPic2PicModel()

    @ApiOperation("文生图")
    @PostMapping("text2pic")
    fun text2pic(textToPicParam: TextToPicParam): Data<Boolean> = userRecordApiService.text2pic(textToPicParam)

    @ApiOperation("文生图回调")
    @PostMapping("text2picCallback")
    fun text2picCallback(textToPicParam: TextToPicParam) = userRecordApiService.text2picCallback(textToPicParam)

    @ApiOperation("图生图")
    @PostMapping("pic2pic")
    fun pic2pic(picToPicParam: PicToPicParam): Data<PicProcessResultVo> = userRecordApiService.pic2pic(picToPicParam)


    @ApiOperation("卡通头像")
    @PostMapping("cartoonPic")
    fun cartoonPic(cartoonParam: CartoonParam): Data<PicProcessResultVo> = userRecordApiService.cartoonPic(cartoonParam)


    @ApiOperation("我的作品列表")
    @PostMapping("myRecordList")
    fun myRecordList(myRecordDto: MyRecordDto): Data<PageData<MyRecordVo>> = userRecordApiService.myRecordList(myRecordDto)


    @ApiOperation("批量移除我的记录列表")
    @GetMapping("removeMyRecord")
    fun removeMyRecord(ids: String): Data<Boolean> = userRecordApiService.removeMyRecord(ids)


    @ApiOperation("收藏作品")
    @GetMapping("collectRecord")
    fun collectRecord(id: Int): Data<Boolean> = userRecordApiService.collectRecord(id)


    @ApiOperation("点赞作品")
    @GetMapping("likeRecord")
    fun likeRecord(id: Int): Data<Boolean> = userRecordApiService.likeRecord(id)


    @ApiOperation("举报作品")
    @GetMapping("reportRecord")
    fun reportRecord(recordReportDto: TemplateReportService.RecordReportDto): Data<Boolean> =
        userRecordApiService.reportRecord(recordReportDto)

    @ApiOperation("获取我的收藏列表")
    @GetMapping("myCollect")
    fun myCollect(myCollectDto: MyCollectDto): Data<PageData<MyRecordVo>> = userRecordApiService.myCollect(myCollectDto)

    @ApiOperation("推荐作品")
    @GetMapping("recommendMyRecord")
    fun recommendMyRecord(id: Int): Data<Boolean> = userRecordApiService.recommendMyRecord(id)


}